package com.guoxue.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.guoxue.dao.ICollectAndTransferDao;
import com.guoxue.domain.CollectAndTransferVo;
@Repository
public class CollectAndTransferImpl extends BaseDaoImpl<CollectAndTransferVo> implements ICollectAndTransferDao{
	
	@Override
	public void saveCollectAndTransfer(CollectAndTransferVo ct) {
		saveOrUpdate(ct);
	}
	
	@Override
	public List<CollectAndTransferVo> getCollectAndTransferList() {
		return find("FROM CollectAndTransferVo");
	}
	
	@Override
	public void deleteCollectAndTransfer(int id) {
		executeHql("DELETE FROM CollectAndTransferVo c WHERE c.id=?", new Object[] {id});
	}

	@Override
	public Long getCollectAndTransferTotal(int uid,int type) {
		return count("SELECT count(*) FROM CollectAndTransferVo c WHERE c.uid = ? AND c.type = ?",new Object[] {uid,type});
	}
	
	@Override
	public CollectAndTransferVo getCollectAndTransfer(int  id) {
		return get("FROM CollectAndTransferVo c WHERE c.id = ?", new Object[] {id});
	}
	
}
